{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "15\n",
      "/live/flight/CSN3039/history/20180615/0500Z/ZGGG/WSSS\n",
      "/live/flight/CSN3039/history/20180613/0500Z/ZGGG/WSSS\n",
      "/live/flight/CSN3039/history/20180612/0445Z/ZGGG/WSSS\n",
      "/live/flight/CSN3039/history/20180611/0500Z/ZGGG/WSSS\n",
      "/live/flight/CSN3039/history/20180610/0445Z/ZGGG/WSSS\n",
      "/live/flight/CSN3039/history/20180609/0445Z/ZGGG/WSSS\n",
      "/live/flight/CSN3039/history/20180608/0500Z/ZGGG/WSSS\n",
      "/live/flight/CSN3039/history/20180607/0445Z/ZGGG/WSSS\n",
      "/live/flight/CSN3039/history/20180606/0500Z/ZGGG/WSSS\n",
      "/live/flight/CSN3039/history/20180605/0445Z/ZGGG/WSSS\n",
      "/live/flight/CSN3039/history/20180604/0500Z/ZGGG/WSSS\n",
      "/live/flight/CSN3039/history/20180603/0445Z/ZGGG/WSSS\n",
      "/live/flight/CSN3039/history/20180602/0445Z/ZGGG/WSSS\n",
      "/live/flight/CSN3039/history/20180601/0500Z/ZGGG/WSSS\n",
      "/live/flight/CSN3039/history/20180531/0445Z/ZGGG/WSSS\n"
     ]
    }
   ],
   "source": [
    "import requests\n",
    "from bs4 import BeautifulSoup\n",
    "\n",
    "headers = {'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko'}\n",
    "\n",
    "flight_rul= 'https://zh.flightaware.com/live/flight/CSN3039/history'\n",
    "f = requests.get(flight_rul, headers=headers)\n",
    "soup = BeautifulSoup(f.text, \"lxml\")\n",
    "records= soup.find_all(\"tr\", class_=\"rowClickTarget\")\n",
    "print(len(records))\n",
    "for r in records:\n",
    "    print ( r['data-target'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
